<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta
    name="description"
    content="SwaggerUI"
  />
  <title>SwaggerUI</title>
  <!-- <link rel="stylesheet" type="text/css" href="./swagger-ui.css" /> -->
  <!-- <link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui.css" /> -->
  <!-- <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/swagger-ui/4.16.0/swagger-ui.min.css" /> -->
     <link rel="stylesheet" href="./swagger-ui.min.css" />


</head>
<body>
  <div id = "list"></div>
  <div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js" crossorigin ></script>
<script src="./swagger-ui-standalone-preset.js" crossorigin ></script>


<script>
  var fileList=[
    {
      name: "API 网关配置接口",
      url:"./helper_api_gateway.yaml",
    },
    {
      name: "copilot配置接口",
      url:"./helper_copilot_conf.yaml",
    },
    {
      name: "健康检查接口",
      url:"./helper_hc.yaml",
    },
    {
      name: "动态access log 配置接口",
      url:"./helper_dynlog.yaml",
    },
    {
      name: "动态telemetry 配置接口",
      url:"./helper_telemetry.yaml",
    },
    {
      name: "动态vts 配置接口",
      url:"./helper_vts.yaml",
    },
    {
      name: "动态split_clients2 配置接口",
      url:"./helper_split_clients_2.yaml",
    },
    {
      name: "动态黑白名单配置接口",
      url:"./helper_dyn_bwlist.yaml",
    },
    {
      name: "动态http server ssl 配置接口",
      url:"./helper_dynssl.yaml",
    },
    {
      name: "sendmsg模块kv接口",
      url:"./helper_kv.yaml",
    },
	  {
      name: "upstream api配置接口",
      url:"./helper_upstream.yaml",
    },
	  {
      name: "动态location配置接口",
      url:"./helper_dy_loc.yaml",
    },
	  {
      name: "动态telemetry webserver配置接口",
      url:"./helper_otel_webserver.yaml",
    },
    {
      name: "动态limit限流接口",
      url:"./helper_dyn_limit.yaml",
    },
    {
      name: "动态split_clients 配置接口",
      url:"./helper_split_clients.yaml",
    },
    {
      name: "动态故障注入配置接口",
      url:"./helper_dyn_fault_inject.yaml",
    },
    {
      name: "动态http_map 配置接口",
      url:"./helper_dyn_map.yaml",
    },
    {
      name: "动态modsecurity 配置接口",
      url:"./helper_dyn_modsecurity.yaml",
    },
    {
      name: "动态range 配置接口",
      url:"./helper_dyn_range.yaml",
    },
    {

      name: "动态VS配置接口",
      url:"./helper_dy_srv.yaml",
    },
    {
      name: "cache加速配置接口",
      url:"./helper_cache_quick.yaml",
    },
    {
      name: "动态stream_map 配置接口",
      url:"./helper_stream_dyn_map.yaml",
    },
    {
      name: "动态stream_sts 配置接口",
      url: "./helper_stream_dyn_sts.yaml",
    },
    {
      name: "动态lua 配置接口",
      url:"./helper_dyn_lua.yaml",
    },
    {
      name: "用户认证密码配置接口",
      url:"./helper_http_auth_passwd.yaml",
    },
    {
      name: "动态auth认证配置接口",
      url:"./helper_dyn_auth.yaml",
    },
    {
      name: "动态proxy_pass配置接口",
      url: "./helper_dyn_pass.yaml",
    },
    {
      name: "动态crl证书吊销列表配置接口",
      url:"./helper_dyn_crl.yaml",
    },
    {
      name: "动态http header配置接口",
      url:"./helper_dyn_header.yaml",
    },
    {
      name: "动态http upstream配置接口",
      url:"./helper_dyn_http_ups.yaml",
    },
    {
       name: "共享zone可扩展属性配置接口",
       url:"./helper_dyn_http_shm.yaml",
    }
  ]

  function changeFile(url){
    var box = document.getElementById("swagger-ui");
    box.remove();
    let div = document.createElement('div')
    div.id = "swagger-ui";
    document.body.appendChild(div);
    setUiFile(url);
  }
  function setUiFile(url){
          // Begin Swagger UI call region
    window.ui = SwaggerUIBundle({
        url: url,
        dom_id: '#swagger-ui',
        deepLinking: true,
        presets: [
          SwaggerUIBundle.presets.apis,
          SwaggerUIStandalonePreset
        ],
        layout: "BaseLayout"
      });
      // End Swagger UI call region
  }
  window.onload = function() {
    fileList.forEach((element,index) => {
      let button = document.createElement('button');
      button.innerText=element.name;
      button.onclick = function(){
        changeFile(element.url);
        location.hash='#'+index;
      }
      let list = document.getElementById("list");
      list.appendChild(button);
    });
    if(location.hash != ''){
      let index = parseInt(location.hash.substring(1));
      if(isNaN(index)){
        index = 0;
      }
      setUiFile(fileList[index].url);
      location.hash='#'+index;
    }else{
      setUiFile(fileList[0].url);
    }
    
  };
</script>
</body>
</html>
